/*
 * CodeSaveCommand.java
 *
 * Created on 2006년 3월 29일 (수), 오후 4:11
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.welfare.admin.service;

import java.util.*;

import java.io.File;
import javax.servlet.*;
import javax.servlet.http.*;

import com.zll.framework.model.HashBox;
import com.zll.framework.model.HashList;
import com.zll.framework.servlet.Command;
import com.zll.framework.util.StringUtil;




/**
 *
 * @author eastar
 */
public class ServiceSaveCommand implements Command
{
    public String execute(HttpServletRequest  request, HttpServletResponse response)
    throws Exception
    {
    	
    	HashBox box = new HashBox(request);

		ServiceDAO dao = new ServiceDAO();

		dao.saveService(box);


		//결과 페이지 이동
		HashMap result		= new HashMap();
		result.put("result", 	"true");
		
		if ("D".equals(box.get("job_type"))) {
			result.put("target", 	"_opener");
			result.put("action",	"./serviceList.jsp");
		} else if ("C".equals(box.get("job_type"))) {
			result.put("action",	"./serviceDetail.jsp?service_id="+box.get("service_id")+"&tabs_code="+box.get("tabs_code"));
		} else {
			if ("update".equals(box.get("save_type"))) {
				result.put("action",	"./serviceUpdate.jsp?service_id="+box.get("service_id")+"&tabs_code="+box.get("tabs_code"));
			} else {
				result.put("action",	"./serviceDetail.jsp?service_id="+box.get("service_id")+"&tabs_code="+box.get("tabs_code"));
			}
		}

    	request.setAttribute("result", result);

    	return "/common/move_view.jsp";
    }
}
